#绝对布局  窗口指定每一个控件显示的坐标和大小来布局的
import sys
from  PyQt5.QtWidgets import *
class Example(QWidget):
    def __init__(self,parent=None):
        super(Example,self).__init__(parent)
        self.setWindowTitle("表单")
        self.resize(400,100)
        fromLayout=QFormLayout()
        lab1=QLabel("标签1")
        lineEdit1=QLineEdit()

        lab2 = QLabel("标签2")
        lineEdit2 = QLineEdit()

        lab3 = QLabel("标签3")
        lineEdit3 = QLineEdit()

        fromLayout.addRow(lab1,lineEdit1)

        fromLayout.addRow(lab2,lineEdit2)

        fromLayout.addRow(lab3,lineEdit3)
        self.setLayout(fromLayout)
if __name__ == '__main__':
    app=QApplication(sys.argv)
    demo=Example()
    demo.show()
    sys.exit(app.exec_())
